package com.isnmp.nms.framework.discover.service;

import java.net.InetAddress;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import com.isnmp.common.base.MyException;
import com.isnmp.nms.framework.discover.DeviceInfo;
import com.isnmp.nms.framework.discover.DiscoverConfig;
import com.isnmp.nms.framework.discover.ResourceInfo;
import com.isnmp.nms.framework.discover.ResourceSearchMothType;

public class SearchResourceService {
    private List<ResourceInfo> rsList = new Vector();

    public List<ResourceInfo> searchDeviceResource(DeviceInfo paramDeviceInfo) throws MyException {
        List localList = DiscoverConfig.getAllResourceType();
        int i = localList.size();
        ThreadPoolExecutor localThreadPoolExecutor = new ThreadPoolExecutor(i, i, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue());
        Iterator localIterator = localList.iterator();
        while (localIterator.hasNext()) {
            ResourceSearchMothType localResourceSearchMothType = (ResourceSearchMothType) localIterator.next();
            localThreadPoolExecutor.execute(new ResourceSearchTask(paramDeviceInfo, localResourceSearchMothType, this.rsList));
        }
        localThreadPoolExecutor.shutdown();
        try {
            for (boolean bool = false; !bool; bool = localThreadPoolExecutor.awaitTermination(1L, TimeUnit.SECONDS))
                ;
        } catch (InterruptedException localInterruptedException) {
            localInterruptedException.printStackTrace();
        }
        return this.rsList;
    }

    public static void main(String[] paramArrayOfString) {
        try {
            InetAddress localInetAddress = InetAddress.getByName("www.sohu.com");
            System.out.print(localInetAddress.isReachable(5000));
        } catch (Exception localException) {
            localException.printStackTrace();
        }
    }
}